const fs = require('fs');
const path = require('path');
const sharp = require('sharp');

const types = ['INTJ','INTP','ENTJ','ENTP','INFJ','INFP','ENFJ','ENFP','ISTJ','ISFJ','ESTJ','ESFJ','ISTP','ISFP','ESTP','ESFP'];
const outDir = path.join(__dirname, '..', 'MyPro', 'static', 'icons', 'mbti');
const size = 256;
const bg = '#6B5B95';

function svgFor(text) {
  const fontSize = 84;
  return Buffer.from(`\
<svg width="${size}" height="${size}" viewBox="0 0 ${size} ${size}" xmlns="http://www.w3.org/2000/svg">\
  <rect width="100%" height="100%" fill="${bg}" rx="32" ry="32"/>\
  <text x="50%" y="50%" fill="#FFFFFF" font-family="Arial, Helvetica, sans-serif" font-weight="700" font-size="${fontSize}" text-anchor="middle" dominant-baseline="central">${text}</text>\
</svg>`);
}

(async () => {
  if (!fs.existsSync(outDir)) fs.mkdirSync(outDir, { recursive: true });
  for (const t of types) {
    const svg = svgFor(t);
    const file = path.join(outDir, `${t.toLowerCase()}.png`);
    await sharp(svg).png({ quality: 90 }).toFile(file);
    console.log('Generated', file);
  }
})(); 